Execute Non Query
AutomatR.PostgreSQL.Database.ExecuteNonQuery
The "Execute Non Query" activity in AutomatR for PostgreSQL databases allows you to execute a non-query SQL statement on a PostgreSQL database. This activity is useful when you need to perform actions that don't return a result set, such as INSERT, UPDATE, or DELETE operations.
Properties
Name | Description |
---|---|
Input | |
Connection | Provide an NpgsqlConnection variable which will be used to establish a database connection. NpgsqlConnection variables containing the connection to be used. |
Command Text | Provide a SQL query in string format. String variables containing the SQL query to be executed. |
Misc | |
Display Name | Provides a customizable name for the activity displayed in the workflow. The display name enhances clarity and organization within the automation project. String variables containing the desired display name. |
Optional | |
Delay | Specifies the amount of time (in seconds) to wait before executing the "Execute Non Query" activity. Integer variables containing the delay duration. Example: If the amount of time is 1000 milliseconds or 1 sec, i.e., 1. |
Command Timeout | Provide the amount of time (in milliseconds) to wait for the SQL command to run before throwing an error. |
Output | |
Result | The result of the SQL command will be stored in a Nullable<Int32> variable, allowing you to utilize it in subsequent activities or operations. Nullable<Int32> variables to store the result of the non-query execution. |
How to use:
- Drag and drop the "Execute Non Query" activity onto the workflow.
- Configure the properties by specifying the NpgsqlConnection variable obtained from the "Connect" activity and the SQL query to be executed.
- Optionally, configure the delay, command timeout, and customize the display name.
- Execute the workflow to execute the specified non-query SQL statement on the PostgreSQL database.
Example: Consider an example where the "Execute Non Query" activity is used to execute an SQL INSERT statement to add a new record to a table:
Execute Non Query:
Delay: 2
Connection: myDBConnection
Command Text: "INSERT INTO Employees (Name, Age) VALUES ('John Doe', 30)"
Command Timeout: 5000
Result: affectedRows
In this example, the activity executes the SQL INSERT statement to add a new employee record to the "Employees" table. The result, representing the number of affected rows, is stored in the Nullable<Int32>
variable "affectedRows" for further processing in the workflow.